package com.hdsx.restful.glzt.structure.bzbp.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.esri.arcgis.geometry.IGeometry;
import com.hdsx.ao.base.BaseOpearte;
import com.hdsx.restful.glzt.roadline.lxxx.bean.Znode;
import com.hdsx.restful.glzt.structure.bzbp.bean.Bzbp;
import com.hdsx.restful.glzt.structure.bzbp.mapper.BzbpMapper;
import com.hdsx.restful.glzt.structure.bzbp.service.BzbpServer;
import com.hdsx.restful.glzt.structure.ql.bean.IntValueName;
import com.hdsx.restful.glzt.structure.ql.bean.StatisticalResult;
import com.hdsx.restful.util.Dao;
/**
 * qlServer实现类
 *
 */
@Service
public class BzbpServerImpl  extends BaseOpearte<Bzbp> implements BzbpServer {

	public BzbpServerImpl() {
		super("GIS_BZBP");
	}

	@Resource(name="bzbpMapper")
	private BzbpMapper mapper;

	@Override
	public Bzbp getById(String id) {
		return mapper.queryOne(id);
	}

	@Override
	public int queryCount(String lxbm,String xzqhbm,String sxxfx,Double qdzh,Double zdzh,String name) {
		Map<String,Object> parameter=new HashMap<String,Object>();
		parameter.put("lxbm", lxbm);
		parameter.put("xzqhbm", xzqhbm);
		parameter.put("sxxfx", sxxfx);
		parameter.put("qdzh", qdzh);
		parameter.put("zdzh", zdzh);
		parameter.put("name", name);
		return mapper.selectCount(parameter);
	}
	@Override
	public List<Bzbp> queryList(String lxbm,String xzqhbm,String sxxfx,Double qdzh,Double zdzh,String name,int begin, int end) {
		Map<String,Object> parameter=new HashMap<String,Object>();
		parameter.put("lxbm", lxbm);
		parameter.put("xzqhbm", xzqhbm);
		parameter.put("sxxfx", sxxfx);
		parameter.put("qdzh", qdzh);
		parameter.put("zdzh", zdzh);
		parameter.put("name", name);
		parameter.put("begin", begin);
		parameter.put("end", end);
		List<Bzbp> lists=mapper.selectList(parameter);
		return lists;
	}

	@Override
	public Bzbp getOne(String bzbpbm) {
		return mapper.queryOne(bzbpbm);
	}
	
	@Override
	public List<Dao> getShapeById(String id) {
		Bzbp bzbp = mapper.getShapeById(id);
		IGeometry shape=selectShape("ID='"+id+"'");
		bzbp.setShape(shape);
		List<Dao> lists=new ArrayList<Dao>();
		lists.add(new Dao("标识标牌名称",bzbp.getBpmc(),bzbp.getPtx(),bzbp.getPty()));
		lists.add(new Dao("标识标牌编码",bzbp.getBpbm()));
		lists.add(new Dao("所在路线",bzbp.getLxbm()));
		lists.add(new Dao("中心桩号",bzbp.getDwzh()));
		lists.add(new Dao("标识标牌类型",bzbp.getBplx()));
		return lists;
	}
	@Override
	public StatisticalResult countByParameter(Map<String,Object> map) {
		List<IntValueName> seriesData = mapper.countTotalByParameter(map);
		List<String> legendData = mapper.selectClassify(map);
		StatisticalResult sr = new StatisticalResult();
		sr.setChartsText("标识标牌统计");
		sr.setSeriesData(seriesData);
		sr.setLegendData(legendData);
		return sr;
	}
	@Override
   	public List<Znode> bzbpNode() {
   		List<Znode> Node = mapper.node();
   		return Node;
   	}
	
	 @Override
	 public int countTotal(Map<String, Object> map){
		 return mapper.countTotal(map);
	 }
	 @Override
	 public List<Bzbp> listAll(String lxbm,String xzqhbm,String sxxfx,Double qdzh,
			Double zdzh,String name) {
		return mapper.listAll(lxbm,xzqhbm,sxxfx,qdzh,zdzh,name);
	 }
	 @Override
	public Bzbp queryById(String id) {
			return mapper.selectById(id);
	}
	/**
	 * 分类细节
	 */
	@Override
	public List<Bzbp> detail(Map<String, Object> map){
		return mapper.detail(map);
	}
	@Override
	public int countDetail(Map<String, Object> map) {
		return  mapper.countDetail(map);
	}
	@Override
	public List<String> selectName(String name){
		return mapper.selectName(name);
	}
	 
}
